{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langgraph.graph import StateGraph,START,END\n",
    "from langgraph.graph.message import MessagesState,MessageGraph\n",
    "from langchain_core.messages import HumanMessage\n",
    "\n",
    "class MyMessagesState(MessagesState):\n",
    "    foo:int\n",
    "\n",
    "def agent_01(state):\n",
    "    return {\"messages\":[(\"human\",\"world\")],\"foo\":2}\n",
    "\n",
    "_buider = StateGraph(MyMessagesState)\n",
    "\n",
    "_buider.add_node(\"node_01\", agent_01)\n",
    "\n",
    "_buider.add_edge(START,\"node_01\")\n",
    "_buider.add_edge(\"node_01\",END)\n",
    "\n",
    "\n",
    "_graph = _buider.compile()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'messages': [HumanMessage(content='hello', additional_kwargs={}, response_metadata={}, id='6f93c87c-6f7b-405f-a800-b588a4c39640'),\n",
       "  HumanMessage(content='world', additional_kwargs={}, response_metadata={}, id='5e0d2bc8-5efc-49e1-b4e0-a4fe84dc1c3c')],\n",
       " 'foo': 2}"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "_graph.invoke({\"messages\":[HumanMessage(\"hello\")],\"foo\":0})"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py310",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.14"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
